package trong.gold.soft.com.model;
import javax.microedition.media.*;
public class mediaGame {
	private Player backgroundPlayer = null;
	public mediaGame(){
		 try{
			 backgroundPlayer = Manager.createPlayer(getClass().getResourceAsStream("/com/audio/Music.mid"),"audio/midi");
			  backgroundPlayer.prefetch();
		      backgroundPlayer.setLoopCount(-1);
		 }catch(Exception e){
			 
		 }
	}
	public void startMedia(){
		try {
	        if (backgroundPlayer != null) {
	          backgroundPlayer.start();
	        }
	      } catch (Exception e) {
	        e.printStackTrace();
	      }
	}
	public void stopMedia(){
		try {
	        if (backgroundPlayer != null) {
	          backgroundPlayer.stop();
	        }
	      } catch (Exception e) {
	        e.printStackTrace();
	      }
	}
}
